package xyz.riceball.job.job;

import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * <p>
 * 核心任务父类。riceball所有任务必须继承此类
 * </p>
 *
 * @author xiaovcloud
 * @since 2022/6/12 23:10
 */
public abstract class RbJob extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        execute(jobDataMap);
    }

    /**
     * 任务实现逻辑
     *
     * @param params
     */
    protected abstract void execute(JobDataMap params);

}
